# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1Workload do
  @moduledoc """
  A Workload object for managing highly regulated workloads of cloud customers.

  ## Attributes

  *   `billingAccount` (*type:* `String.t`, *default:* `nil`) - Optional. The billing account used for the resources which are direct children of workload. This billing account is initially associated with the resources created as part of Workload creation. After the initial creation of these resources, the customer can change the assigned billing account. The resource name has the form `billingAccounts/{billing_account_id}`. For example, `billingAccounts/012345-567890-ABCDEF`.
  *   `complianceRegime` (*type:* `String.t`, *default:* `nil`) - Required. Immutable. Compliance Regime associated with this workload.
  *   `complianceStatus` (*type:* `GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadComplianceStatus.t`, *default:* `nil`) - Output only. Count of active Violations in the Workload.
  *   `compliantButDisallowedServices` (*type:* `list(String.t)`, *default:* `nil`) - Output only. Urls for services which are compliant for this Assured Workload, but which are currently disallowed by the ResourceUsageRestriction org policy. Invoke RestrictAllowedResources endpoint to allow your project developers to use these services in their environment.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Immutable. The Workload creation timestamp.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. The user-assigned display name of the Workload. When present it must be between 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, hyphen, and spaces. Example: My Workload
  *   `ekmProvisioningResponse` (*type:* `GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadEkmProvisioningResponse.t`, *default:* `nil`) - Output only. Represents the Ekm Provisioning State of the given workload.
  *   `enableSovereignControls` (*type:* `boolean()`, *default:* `nil`) - Optional. Indicates the sovereignty status of the given workload. Currently meant to be used by Europe/Canada customers.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - Optional. ETag of the workload, it is calculated on the basis of the Workload contents. It will be used in Update & Delete operations.
  *   `kajEnrollmentState` (*type:* `String.t`, *default:* `nil`) - Output only. Represents the KAJ enrollment state of the given workload.
  *   `kmsSettings` (*type:* `GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadKMSSettings.t`, *default:* `nil`) - Input only. Settings used to create a CMEK crypto key. When set, a project with a KMS CMEK key is provisioned. This field is deprecated as of Feb 28, 2022. In order to create a Keyring, callers should specify, ENCRYPTION_KEYS_PROJECT or KEYRING in ResourceSettings.resource_type field.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Optional. Labels applied to the workload.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Optional. The resource name of the workload. Format: organizations/{organization}/locations/{location}/workloads/{workload} Read-only.
  *   `partner` (*type:* `String.t`, *default:* `nil`) - Optional. Partner regime associated with this workload.
  *   `partnerPermissions` (*type:* `GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadPartnerPermissions.t`, *default:* `nil`) - Optional. Permissions granted to the AW Partner SA account for the customer workload
  *   `partnerServicesBillingAccount` (*type:* `String.t`, *default:* `nil`) - Optional. Billing account necessary for purchasing services from Sovereign Partners. This field is required for creating SIA/PSN/CNTXT partner workloads. The caller should have 'billing.resourceAssociations.create' IAM permission on this billing-account. The format of this string is billingAccounts/AAAAAA-BBBBBB-CCCCCC
  *   `provisionedResourcesParent` (*type:* `String.t`, *default:* `nil`) - Input only. The parent resource for the resources managed by this Assured Workload. May be either empty or a folder resource which is a child of the Workload parent. If not specified all resources are created under the parent organization. Format: folders/{folder_id}
  *   `resourceMonitoringEnabled` (*type:* `boolean()`, *default:* `nil`) - Output only. Indicates whether resource monitoring is enabled for workload or not. It is true when Resource feed is subscribed to AWM topic and AWM Service Agent Role is binded to AW Service Account for resource Assured workload.
  *   `resourceSettings` (*type:* `list(GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadResourceSettings.t)`, *default:* `nil`) - Input only. Resource properties that are used to customize workload resources. These properties (such as custom project id) will be used to create workload resources if possible. This field is optional.
  *   `resources` (*type:* `list(GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadResourceInfo.t)`, *default:* `nil`) - Output only. The resources associated with this workload. These resources will be created when creating the workload. If any of the projects already exist, the workload creation will fail. Always read only.
  *   `saaEnrollmentResponse` (*type:* `GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadSaaEnrollmentResponse.t`, *default:* `nil`) - Output only. Represents the SAA enrollment response of the given workload. SAA enrollment response is queried during GetWorkload call. In failure cases, user friendly error message is shown in SAA details page.
  *   `violationNotificationsEnabled` (*type:* `boolean()`, *default:* `nil`) - Optional. Indicates whether the e-mail notification for a violation is enabled for a workload. This value will be by default True, and if not present will be considered as true. This should only be updated via updateWorkload call. Any Changes to this field during the createWorkload call will not be honored. This will always be true while creating the workload.
  *   `workloadOptions` (*type:* `GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadWorkloadOptions.t`, *default:* `nil`) - Optional. Options to be set for the given created workload.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :billingAccount => String.t() | nil,
          :complianceRegime => String.t() | nil,
          :complianceStatus =>
            GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadComplianceStatus.t()
            | nil,
          :compliantButDisallowedServices => list(String.t()) | nil,
          :createTime => DateTime.t() | nil,
          :displayName => String.t() | nil,
          :ekmProvisioningResponse =>
            GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadEkmProvisioningResponse.t()
            | nil,
          :enableSovereignControls => boolean() | nil,
          :etag => String.t() | nil,
          :kajEnrollmentState => String.t() | nil,
          :kmsSettings =>
            GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadKMSSettings.t()
            | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :partner => String.t() | nil,
          :partnerPermissions =>
            GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadPartnerPermissions.t()
            | nil,
          :partnerServicesBillingAccount => String.t() | nil,
          :provisionedResourcesParent => String.t() | nil,
          :resourceMonitoringEnabled => boolean() | nil,
          :resourceSettings =>
            list(
              GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadResourceSettings.t()
            )
            | nil,
          :resources =>
            list(
              GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadResourceInfo.t()
            )
            | nil,
          :saaEnrollmentResponse =>
            GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadSaaEnrollmentResponse.t()
            | nil,
          :violationNotificationsEnabled => boolean() | nil,
          :workloadOptions =>
            GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadWorkloadOptions.t()
            | nil
        }

  field(:billingAccount)
  field(:complianceRegime)

  field(:complianceStatus,
    as: GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadComplianceStatus
  )

  field(:compliantButDisallowedServices, type: :list)
  field(:createTime, as: DateTime)
  field(:displayName)

  field(:ekmProvisioningResponse,
    as:
      GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadEkmProvisioningResponse
  )

  field(:enableSovereignControls)
  field(:etag)
  field(:kajEnrollmentState)

  field(:kmsSettings,
    as: GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadKMSSettings
  )

  field(:labels, type: :map)
  field(:name)
  field(:partner)

  field(:partnerPermissions,
    as:
      GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadPartnerPermissions
  )

  field(:partnerServicesBillingAccount)
  field(:provisionedResourcesParent)
  field(:resourceMonitoringEnabled)

  field(:resourceSettings,
    as: GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadResourceSettings,
    type: :list
  )

  field(:resources,
    as: GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadResourceInfo,
    type: :list
  )

  field(:saaEnrollmentResponse,
    as:
      GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadSaaEnrollmentResponse
  )

  field(:violationNotificationsEnabled)

  field(:workloadOptions,
    as: GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1WorkloadWorkloadOptions
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1Workload do
  def decode(value, options) do
    GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1Workload.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AssuredWorkloads.V1.Model.GoogleCloudAssuredworkloadsV1Workload do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
